﻿<%@ Register TagPrefix="ucCommon" TagName="Common" Src="../Common/Inc/Common.ascx" %>
<%@ Register TagPrefix="ucTabTitle" TagName="TabTitle" Src="../Common/Inc/TabTitle.ascx" %>
<%@ Register TagPrefix="ucCopyright" TagName="Copyright" Src="../Common/Inc/Copyright.ascx" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Fit3014p.aspx.cs" Inherits="Updms.Fit.Fit3014p" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>▒ UPDMS [Fit3014p] ▒▒▒▒▒▒▒▒▒▒</title>
<ucCommon:Common id="Common" runat="server"></ucCommon:Common>
<script type="text/javascript" language="javascript">
	//실제운동기록 - 중량x반복횟수
	function calcRealTotalWeight(idx) {
		var weight;
		var count;
		var total_weight;

		weight = "txt_real_action_weight_" + idx;
		count = "txt_real_action_count_" + idx;
		total_weight = "txt_real_total_weight_" + idx;

		$(total_weight).value = Number(delComma($(weight).value)) * Number(delComma($(count).value));

		calcTotal();
	}

	//실제운동기록 - Total
	function calcTotal() {
		var total_weight = 0;
		for (var i = 1; i <= 7; i++) {
			total_weight += Number($("txt_real_total_weight_" + i).value);
		}
		$("lbl_real_training_total").innerHTML = total_weight;

		calcDiff();
	}

	//결과입력용 - 중량x반복횟수
	function calcInputTotalWeight() {
		$("txt_input_total_weight").value =
			Number($("txt_input_set").value) * //세트
			Number($("txt_input_action_weight").value) * //중량
			Number($("txt_input_action_count").value); //반복횟수

		calcDiff();
	}

	//차이중량 (실제운동기록 - 결과입력용)
	function calcDiff() {
		$("lbl_diff").innerHTML =
			Number($("lbl_real_training_total").innerHTML) - Number($("txt_input_total_weight").value);

		setSummary();
	}

	//cs에서 자바스크립트 호출, 기본값 설정후 호출
	function callAllFunction() {
		for (var i = 1; i <= 7; i++) {
			calcRealTotalWeight(i);
		}

		calcInputTotalWeight();
	}

	//실제운동기록 내용삭제
	function clearRealTotalWeight(idx) {
		weight = "txt_real_action_weight_" + idx;
		count = "txt_real_action_count_" + idx;
		total_weight = "txt_real_total_weight_" + idx;

		$(weight).value = "";
		$(count).value = "";
		$(total_weight).value = "";

		callAllFunction();
	}

	//요약
	function setSummary() {
		var summry = "";
		$(txt_summary).value = "";

		for (var i = 1; i <= 7; i++) {
			var weight = Number($("txt_real_action_weight_" + i).value); //중량
			var count = Number($("txt_real_action_count_" + i).value); //반복횟수
			var line = i + ") " + weight + "kg:" + count + "회";

			if (weight > 0 && count > 0) {
				if (i == 1) {
					summry = summry + line;
				}
				else {
					summry = summry + "\n" + line;
				}
			}
		}

		$(txt_summary).value = summry;
	}
</script>
</head>
<body>
<form id="form1" runat="server">
<table id="table_frame">
	<tr>
		<td id="contents_area">
			<!-- 제목 시작 -->
			<ucTabTitle:TabTitle id="TabTitle" TagPrefixs="Fit3014p" runat="server"></ucTabTitle:TabTitle>
			<!-- 제목 끝 -->
			<!-- 버튼 시작 -->
			<div class="button_area">
				<asp:linkbutton id="ibtn_close" Text="닫기" runat="server" CssClass="ibtn ibtn_close" OnClientClick="javascript:window.close();return false;"></asp:linkbutton>
				<asp:linkbutton id="ibtn_reload" Text="새로고침" runat="server" CssClass="ibtn ibtn_reload" OnClick="ibtn_reload_Click"></asp:linkbutton>
			</div>
			<!-- 버튼 끝 -->
			<!-- 디테일1 시작 -->
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td>
						<!-- 실제운동기록 -->
						<div class="sub_title_icon"><asp:Literal id="ltr_stitle_real_training" Text="실제운동기록" runat="server" /></div>
						<table id="table_real_training" class="table_gridview" runat="server">
							<tr>
								<th style="width:9%"><asp:Literal id="ltr_real_set" Text="세트" runat="server" /></th>
								<th style="width:22%"><asp:Literal id="ltr_real_action_weight" Text="중량" runat="server" /></th>
								<th style="width:20%"><asp:Literal id="ltr_real_action_count" Text="반복횟수" runat="server" /></th>
								<th style="width:40%"><asp:Literal id="ltr_real_total_weight" Text="중량 * 반복횟수" runat="server" /></th>
								<th style="width:9%"><asp:Literal id="ltr_real_del" Text="삭제" runat="server" /></th>
							</tr>
							<tr>
								<td style="text-align:center;">1</td>
								<td><asp:textbox id="txt_real_action_weight_1" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_action_count_1" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_total_weight_1" runat="server" CssClass="ib_b_R" Width="100%" readonly="true"></asp:textbox></td>
								<td><a href="javascript:void(0);" onclick="clearRealTotalWeight(1);" class="sbtn sbtn_file_del" style="margin:0 0 0 5px"></a></td>
							</tr>
							<tr>
								<td style="text-align:center;">2</td>
								<td><asp:textbox id="txt_real_action_weight_2" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_action_count_2" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_total_weight_2" runat="server" CssClass="ib_b_R" Width="100%" readonly="true"></asp:textbox></td>
								<td><a href="javascript:void(0);" onclick="clearRealTotalWeight(2);" class="sbtn sbtn_file_del" style="margin:0 0 0 5px"></a></td>
							</tr>
							<tr>
								<td style="text-align:center;">3</td>
								<td><asp:textbox id="txt_real_action_weight_3" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_action_count_3" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_total_weight_3" runat="server" CssClass="ib_b_R" Width="100%" readonly="true"></asp:textbox></td>
								<td><a href="javascript:void(0);" onclick="clearRealTotalWeight(3);" class="sbtn sbtn_file_del" style="margin:0 0 0 5px"></a></td>
							</tr>
							<tr>
								<td style="text-align:center;">4</td>
								<td><asp:textbox id="txt_real_action_weight_4" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_action_count_4" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_total_weight_4" runat="server" CssClass="ib_b_R" Width="100%" readonly="true"></asp:textbox></td>
								<td><a href="javascript:void(0);" onclick="clearRealTotalWeight(4);" class="sbtn sbtn_file_del" style="margin:0 0 0 5px"></a></td>
							</tr>
							<tr>
								<td style="text-align:center;">5</td>
								<td><asp:textbox id="txt_real_action_weight_5" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_action_count_5" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_total_weight_5" runat="server" CssClass="ib_b_R" Width="100%" readonly="true"></asp:textbox></td>
								<td><a href="javascript:void(0);" onclick="clearRealTotalWeight(5);" class="sbtn sbtn_file_del" style="margin:0 0 0 5px"></a></td>
							</tr>
							<tr>
								<td style="text-align:center;">6</td>
								<td><asp:textbox id="txt_real_action_weight_6" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_action_count_6" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_total_weight_6" runat="server" CssClass="ib_b_R" Width="100%" readonly="true"></asp:textbox></td>
								<td><a href="javascript:void(0);" onclick="clearRealTotalWeight(6);" class="sbtn sbtn_file_del" style="margin:0 0 0 5px"></a></td>
							</tr>
							<tr>
								<td style="text-align:center;">7</td>
								<td><asp:textbox id="txt_real_action_weight_7" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_action_count_7" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_real_total_weight_7" runat="server" CssClass="ib_b_R" Width="100%" readonly="true"></asp:textbox></td>
								<td><a href="javascript:void(0);" onclick="clearRealTotalWeight(7);" class="sbtn sbtn_file_del" style="margin:0 0 0 5px"></a></td>
							</tr>
							<tr>
								<td colspan="3" class="total">Total</td>
								<td class="money"><asp:label id="lbl_real_training_total" Font-Bold="true" runat="server"></asp:label></td>
								<td class="total"></td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td style="padding:6px 0 0 0;">
						<!-- 결과입력용 -->
						<div class="sub_title_icon"><asp:Literal id="ltr_stitle_input_training" Text="결과입력용" runat="server" /></div>
						<table class="table_gridview">
							<tr>
								<th style="width:9%"><asp:Literal id="ltr_input_set" Text="세트" runat="server" /></th>
								<th style="width:22%"><asp:Literal id="ltr_input_action_weight" Text="중량" runat="server" /></th>
								<th style="width:20%"><asp:Literal id="ltr_input_action_count" Text="반복횟수" runat="server" /></th>
								<th style="width:49%"><asp:Literal id="ltr_input_total_weight" Text="세트 * 중량 * 반복횟수" runat="server" /></th>
							</tr>
							<tr>
								<td><asp:textbox id="txt_input_set" runat="server" CssClass="ib_b_C" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_input_action_weight" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_input_action_count" runat="server" CssClass="ib_b_R" Width="100%"></asp:textbox></td>
								<td><asp:textbox id="txt_input_total_weight" runat="server" CssClass="ib_b_R b" Width="100%" readonly="true"></asp:textbox></td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td style="padding:6px 0 0 0;">
						<table class="table_detail">
							<tr>
								<td style="width:31%" class="lbl"><asp:Literal id="ltr_diff" Text="중량차이" runat="server" /></td>
								<td style="width:69%;text-align:right;padding:0 4px 0 0;" class="ctl"><asp:label id="lbl_diff" Font-Bold="true" runat="server" Width="99%"></asp:label></td>
							</tr>
							<tr>
								<td class="lbl"><asp:Literal id="ltr_summary" Text="요약" runat="server" /></td>
								<td class="ctl" style="padding:1px"><asp:textbox id="txt_summary" runat="server" Width="100%" CssClass="tb_scroll" TextMode="MultiLine" Rows="9" Height="120"></asp:textbox></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			<!-- 디테일1 끝 -->
			<!-- 리스트 시작 -->
			<!-- 리스트 끝 -->
			<!-- 카피라이트 시작 -->
			<!-- 카피라이트 끝 -->
			<!-- 히든값 시작 -->
			<!-- 히든값 끝 -->
		</td>
	</tr>
</table>
</form>
</body>
</html>